<?php

namespace app\logic\system;

use think\facade\Queue;
use app\logic\BaseLogic;
use app\common\library\SnowFlake;

class NotifyLogic extends BaseLogic
{
    /**
     * 推送消息
     * @param string $type 推送类型
     * @param array $user_ids 用户id
     * @param string $title 标题
     * @param string $content 内容
     * @return string
     */
    public function pushMessage($type, $user_ids, $title, $content): string
    {
        $data = [
            'queue_id' => SnowFlake::generateParticle(),
            'type'    => $type,
            'user_ids' =>  $user_ids,
            'title'   => $title,
            'content' => $content
        ];
        $res = Queue::push(\app\job\queue\SystemNotifyJob::class, $data, 'SystemNotifyJob');
        return $res;
    }
}